import React, {createContext, useContext} from 'react'
import {useLocalStorage} from '@rehooks/local-storage'

const AuthContext = createContext();

export const useAuth = ()=>useContext(AuthContext)
export const avatarBaseUrl = 'http://8.142.171.141:8080/school-news/user/img?path='

const AuthProvider = ({children}) => {
    const [user,setUser,deleteUser] = useLocalStorage('user',{});
    return (
        <AuthContext.Provider value={ {user,setUser,deleteUser} }>
            {children}
        </AuthContext.Provider>
    )
}

export default AuthProvider